/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.edu.ugb.modelo.dto;

import java.io.Serializable;

/**
 *
 * @author Funes
 */
public class AlumnosDTO implements Serializable{
    
    private static final String SELECT_ALL_COUNT = "select count(*) from usuario ";
    private static final String SELECT_ALL = "select * from usuario ";
    private static final String INSERT = "insert into notas.usuario(login,password,${0})"+"values(?,?,${1})";
    public static final String INSERT2 = "insert into usuario(login,password) values(?,?)";
    private static final String DELETE = "delete from usuario where id=?";
    private static final String UPDATE_BASE = "UPDATE usuario SET ${0} WHERE id = ?";
    private static final String SELECT_LIKE_NOMBRES = "select * from usuaeio where login like ?";
    private Integer id;
    private String login;
    private String password;
    
    //constructor vacio

    public AlumnosDTO() {
    }
    
    //getter and setter

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    
    //hashcode and equals

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final AlumnosDTO other = (AlumnosDTO) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
    
    //string toString

    @Override
    public String toString() {
        return "usuarioDTO{" + "id=" + id + ", login=" + login + ", password=" + password + '}';
    }
    
    //getters de Sentencias

    public static String getSELECT_ALL_COUNT() {
        return SELECT_ALL_COUNT;
    }

    public static String getSELECT_ALL() {
        return SELECT_ALL;
    }

    public static String getInsert(StringBuilder cols, StringBuilder marks) {
        if (cols.length() == 0 && marks.length() == 0) {

            return INSERT.replace(",${0}", "").replace(",${1}", "");
        } else {

            return INSERT.replace("${0}", cols.toString()).replace("${1}", marks.toString());
        }
    }

    public static String getDELETE() {
        return DELETE;
    }

    public static String getUPDATE_BASE() {
        return UPDATE_BASE;
    }

    public static String getSELECT_LIKE_NOMBRES() {
        return SELECT_LIKE_NOMBRES;
    }
    
    
}
